﻿@model ListFieldDefinitionModel

@{
    ViewBag.Title = "Fields";
}

<div class="folder">
    <h2 class="folder-heading">@Model.FormName > @Loc("Form fields")</h2>

    @{
        
        UI.Grid(Model.Fields)
            .SetEmptyText((L)"No Fields")
            .AddColumn((L)"ID", f => f.FieldDefinitionID, "w30")
            .AddColumn((L)"Identifier", f => f.PublicIdentifier, "w50")
            .AddColumn((L)"Name", f => f.Name)
            .AddColumn((L)"Required", f => f.Required ? (L)"Yes" : (L)"No", "w50")
            .AddColumn((L)"Field type", f => (L)Neptuo.Forms.Core.FieldType.GetTypes().First(i => i.Key == f.FieldType).Value, "w100")
            .AddColumn("", f => Html.ActionLink((L)"Edit", "edit", "fielddefinition", new { fieldDefinitionID = f.FieldDefinitionID }, null), "w50")
            .Render();
        
    }

    <div class="folder-foot">
        @Html.ActionLink((L)"+Create", "create", "fielddefinition")
        @*@if (Model.FormType == Neptuo.Forms.Core.FormType.Form)
        {
            @Html.ActionLink((L)"+Create reference field", "createreference", "fielddefinition")
        }*@
        |
        @Html.ActionLink((L)"Back to forms", "forms", "project", new { ProjectID = Model.ProjectID }, null)
    </div>
</div>
